﻿using Ext.Net;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using NOAH.CMS.Repository;
using NOAH.CMS.Infracstructure;
using NOAH.CMS.Cache;

public partial class admin_Subject_Default : System.Web.UI.Page
{
    public void Delete(object sender, DirectEventArgs e)
    {
        try
        {
            using (SubjectRepository repository = new SubjectRepository())
            {
                CheckboxSelectionModel selectionModel = (CheckboxSelectionModel)this.gridViewUser.SelectionModel.Primary;
                foreach (SelectedRow row in selectionModel.SelectedRows)
                {
                    repository.Delete(int.Parse(row.RecordID));
                }
                repository.SubmitChanges();
                this.PagingToolBar1.PageIndex = 1;
                Util.ShowMessage(Constants.UPDATE_SUCCESS);
            }
        }
        catch
        {
            Util.ShowMessage2(Constants.UPDATE_FAILURE);
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

}